c# linq unique by property

100

c# linq unique by property -

List<Person> distinctPeople = allPeople
   .GroupBy(p => p.PersonId)
   .Select(g => g.FirstOrDefault())
   .ToList();

c# linq unique by property -

Persons.ToLookup(p => p.Id).Select(coll => coll.First());

Comments

Submit
0 Comments